// pages/teambox/teamcreate/teamcreate.js
import {
  createTeam
} from '../../../utils/networkRequest.js'
import {
  errorMsg
} from '../../../utils/tool.js'
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {

  },
  /**
   * 获取团队名称
   */
  getNickName: function(e) {
    this.setData({
      nickName: e.detail.value
    })

  },
  createTeam: function() {
    let {
      nickName
    } = this.data;
    createTeam(nickName, (r) => {
      if (r.code == 0) {
          wx.navigateBack();
      } else {
        errorMsg(r.message);
      }
    })
  }


})